package com.hxkj.controller;

import com.hxkj.domain.po.Column;
import com.hxkj.domain.po.OptionColumnTree;
import com.hxkj.service.OptionColumnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.Callable;

/**
 * @ClassName OptionColumnController
 * @Description TODO
 * @Author Mr.zheng
 * @Date 2018/6/30 10:10
 * @Version 1.0
 */
@RestController
@RequestMapping("/optioncolumn")
public class OptionColumnController {

    @Autowired
    private OptionColumnService optionColumnService;

    /**
    * @author Mr.zheng
    * @Description getOptionColumnTreeList 解析多个分类树下的文章列表
    * @Date 10:34 2018/6/30
    **/
    @RequestMapping(value = "/getlist", method = RequestMethod.POST,consumes  ="application/json;charset=UTF-8")
    public Callable<List<OptionColumnTree>> getOptionColumnTreeList(@RequestBody Column column) throws Exception{
        return () -> optionColumnService.getOptionColumnTreeList(column);
    }


    /**
    * @author Mr.zheng
    * @Description getOptionColumnTree 解析单个分类树下的文章列表
    * @Date 10:34 2018/6/30
    **/
    @RequestMapping(value = "/get", method = RequestMethod.POST,consumes  ="application/json;charset=UTF-8")
    public Callable<OptionColumnTree> getOptionColumnTree(@RequestBody Column column) throws Exception{
        return () -> optionColumnService.getOptionColumnTree(column);
    }

    /**
    * @author Mr.zheng
    * @Description getColumnTree 解析单个分类树
    * @Date 10:34 2018/6/30
    **/
    @RequestMapping(value = "/getColumnTree", method = RequestMethod.POST,consumes  ="application/json;charset=UTF-8")
    public Callable<OptionColumnTree> getColumnTree(@RequestBody Column column) throws Exception{
        return () -> optionColumnService.getColumnTree(column);
    }
}
